package com.fneuch.mwg.rules.dice;

public enum Dice {
	D4(4), D6(6), D8(8), D10(10), D12(12), D20(20); 
	
	private int maxValue;

	private Dice(int maxValue) {
		this.maxValue = maxValue;
	}

	public int getMaxValue() {
		return maxValue;
	}

	public static int roll(Dice diceKind) {
		return rolls(1, diceKind);		
	}

	public static int rolls(int nbDice, Dice diceKind) {
		int rollResult = 0;
		
		for(int i = 0; i< nbDice; i++) {
			rollResult += (int)(Math.random()* diceKind.maxValue) + 1;
		}
		
		return rollResult;		
	}
	
}
